import request from '@/utils/request'

/**
 * 获取员工列表
 *
 * @param { page, pageSize, name } params
 *
 * @returns {Promise}
 */
export function getEmployeeListAPI(params) {
  return request({
    url: '/park/sys/user',
    method: 'get',
    params
  })
}

/**
 * 添加员工
 *
 * @param { name, userName, roleId, status, phonenumber } data
 *
 * @returns {Promise}
 */
export function addEmployeeAPI(data) {
  return request({
    url: '/park/sys/user',
    method: 'post',
    data
  })
}

/**
 * 修改员工
 *
 * @param { id, name, userName, roleId, status, phonenumber } data
 *
 * @returns {Promise}
 */
export function updateEmployeeAPI(data) {
  return request({
    url: '/park/sys/user',
    method: 'put',
    data
  })
}

/**
 * 删除员工
 *
 * @param { String } id
 *
 * @returns {Promise}
 */
export function deleteEmployeeAPI(id) {
  return request({
    url: `/park/sys/user/${id}`,
    method: 'delete'
  })
}

/**
 * 重置密码
 *
 * @param { String } id
 *
 * @returns {Promise}
 */
export function resetPwdAPI(id) {
  return request({
    url: '/park/sys/user/resetPwd',
    method: 'put',
    data: {
      id
    }
  })
}
